class Person {
    constructor(name) {
        this.name = name;
        this.age = 18;
    }
}

let obj1 = {
    levels: [1, 2, 3, 'baby'],
    userName: 'alvin',
    symbol: Symbol(),
    currentDate: new Date(),
    test: /\d/,
    max: Infinity,
    min: -Infinity,
    nothing: null,
    undefined: undefined,
    person: new Person({
        name: 'jnney',
        age: 18,
        gender: 'female'
    })
}

let cloneNew = JSON.parse(JSON.stringify(obj1));
cloneNew.person.name.age = 8
console.log('obj1', obj1)
console.log('cloneNew', cloneNew)
// {
//   levels: [ 1, 2, 3, 'baby' ],
//   userName: 'alvin',
//   currentDate: '2022-11-02T15:34:37.909Z', // 时间被转成了字符串
//   test: {}, // 正则转成了空对象
//   max: null, // Infinity 转成了空
//   min: null,
//   nothing: null,
//   person: { name: { name: 'jnney', age: 8, gender: 'female' }, age: 18 }
// }